package com.control.qct.businesssteward.activity;

import android.support.v4.app.Fragment;
import android.view.View;

import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.base.BaseActivity;
import com.control.qct.businesssteward.entity.TabEntity;
import com.control.qct.businesssteward.fragment.HomeFragment;
import com.control.qct.businesssteward.fragment.MyTheCargoFragment;
import com.control.qct.businesssteward.fragment.SponsorTheCargoFragment;
import com.control.qct.businesssteward.fragment.TheCargoManagementFragment;
import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.listener.CustomTabEntity;
import com.flyco.tablayout.listener.OnTabSelectListener;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * Created by Administrator on 2018/1/29 0029.
 */

public class TheCargoActivity extends BaseActivity implements OnTabSelectListener {
    @BindView(R.id.ctl_bottom)
    CommonTabLayout mCtlBottom;

    private String[] mTitles = {"我的调拨", "被调拨管理", "发起调拨"}; //标题
    private int[] mIconUnselectIds = {R.drawable.icon_shouye_shouye_n, R.drawable.icon_shouye_xiaoxi_n, R.drawable
            .icon_shouye_wode_n}; //未选中图标
    private int[] mIconSelectIds = {R.drawable.icon_shouye_shouye_s, R.drawable.icon_shouye_xiaoxi_s, R.drawable
            .icon_shouye_wode_s}; //选中图标
    private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>(); //布局参数集合
    private ArrayList<Fragment> mFragments = new ArrayList<>();//fragment集合

    public TheCargoActivity() {
        super(R.layout.activity_the_cargo);
    }

    @Override
    protected void initView() {
        setLeftIcon(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        setTitle("调货");
        //添加标题 已选图标 未选图标
        for (int i = 0; i < mTitles.length; i++) {
            mTabEntities.add(new TabEntity(mTitles[i], mIconSelectIds[i], mIconUnselectIds[i]));
        }
        //添加fragment
        mFragments.add(new MyTheCargoFragment());
        mFragments.add(new TheCargoManagementFragment());
        mFragments.add(new SponsorTheCargoFragment());
        /**懒人模式**/
        mCtlBottom.setTabData(mTabEntities, this, R.id.fl_the_cargo_content, mFragments);
        /** 切换状态**/
        mCtlBottom.setOnTabSelectListener(this);
    }

    @Override
    public void onTabSelect(int position) {
        switch (position){
            case 0:
                break;
            case 1:
                break;
            case 2:
                break;
        }
    }

    @Override
    public void onTabReselect(int position) {

    }
}
